package com.zyl.util;

public class CalUtil {
	/**
	 	*手续费(万分之)： 	fee
		*交易品种： 	
		*多空单： 	sign 多为1 空为-1
		*持仓手数： n	
		*开仓价格：open 
		*平仓价格：close 
	 */
	
	public static double agtd(double sign, double open,double close,int n,double fee) {
	
		double result;
		try {
			result = sign*(close-open )*n-n*(open+close)*fee/10000;
		} catch (Exception e) {
			result=0;
		}
		
		return result;
		 
	}
	//总延期费=持仓量×当日结算价×延期费率 一天 一手大约2.3左右
	public static double deferredCharges(int n,double close) {
		
		double result=n*close*0.0003;
		
		return result;
		
	}
	// 费= 价*0.15
	public static double charge( double price) {
		
		double result=price*0.15;
		
		return result;
		
	}
	// 费= 价*0.15 小费
	public static double tip( double price) {
		
		double result=price*0.0015;
		
		return result;
		
	}

}
